package com.alpha.eceasy.extension;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

@EqualsAndHashCode(callSuper = true)
@Data
@JsonIgnoreProperties({"id", "updateTime", "deleted", "tenantId"})
public class BaseFormInfo<T extends Model<?>> extends Model<T> {
    @TableId(type = IdType.AUTO)
    private Long id;
    private String guid;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "创建时间")
    private LocalDateTime createTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "修改时间")
    private LocalDateTime updateTime;
    @Schema(description = "状态0-禁用1-正常")
    private Integer state;
    @TableLogic
    @Schema(description = "是否已删除")
    private Boolean deleted;
    /**
     * 所属租户（哪个租户应用过来的）
     */
    @TableField(exist = false)
    @Schema(description = "所属租户（哪个租户应用过来的）", hidden = true)
    private Long tenantId;
}
